package C;

import java.util.Arrays;
import java.util.Scanner;

public class C47 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] nums = Arrays.stream(sc.nextLine().split(" ")).mapToInt(Integer::parseInt).toArray();
        System.out.println(getResult(nums));
    }

    static public int getResult(int[] nums) {
        int min = Integer.MAX_VALUE;
        int index = 0;
        index = Arrays.binarySearch(nums, 0);
        index = index < 0 ? (-index - 1) : index;

        //非负数
        if (index == 0) {
            return nums[index] + nums[index + 1];
        }
        //非正数
        if (index == nums.length) {
            return Math.abs(nums[index - 1] + nums[index - 2]);
        }
        //有正有负
        //必定是一个正数 和 一个复数
        for (int i = 0; i < index; i++) {
            int idx = Arrays.binarySearch(nums,-nums[i]);
            idx = idx < 0 ? (-idx - 1) : idx;
            if (idx==nums.length) {
                min = Math.min(Math.abs(nums[idx-1] + nums[i]), min);
                continue;
            }
            min = Math.min(Math.abs(nums[idx]+nums[i]),min);
            if (idx-1!=i) {
                min = Math.min(Math.abs(nums[idx-1]+nums[i]),min);
            }
        }
        return min;
    }
}
